package com.springcloud_provider.controller;

import com.springcloud_api.pojo.Dept;
import com.springcloud_provider.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName:DeptController
 * Package:com.springcloud_provider.controller
 * Description
 *
 * @Author:@wenxueshi
 * @Create:2023/2/5 - 14:30
 * @Version:v1.0
 */
@RestController
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    private IDeptService deptService;

    @PostMapping("/add")
    public boolean addDept(@RequestBody Dept dept){
        return deptService.addDept(dept);
    }

    @GetMapping("/{id}")
    public Dept getById(@PathVariable Integer id){
        return deptService.getById(id);
    }

    @GetMapping("/list")
    public List<Dept> findAllDept(){
        return deptService.findAllDept();
    }
}
